
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[gspJob_SEARCH]
(
@jobId int = null,
@countryId int = null,
@regionId int = null,
@cityId int = null,
@fullName nvarchar(400) = null,
@abbreviation nvarchar(100) = null,
@isVisible bit = null,
@isDeleted bit = null,
@createDate datetime = null,
@lastModifiedDate datetime = null
)
AS

SELECT
  *
FROM
  [dbo].[Job]
WHERE
  (@jobId IS NULL OR [JobId] = @jobId)
AND
  (@countryId IS NULL OR [CountryId] = @countryId)
AND
  (@regionId IS NULL OR [RegionId] = @regionId)
AND
  (@cityId IS NULL OR [CityId] = @cityId)
AND
  (@fullName IS NULL OR @fullName = '' OR [FullName] LIKE @fullName + '%')
AND
  (@abbreviation IS NULL OR @abbreviation = '' OR [Abbreviation] LIKE @abbreviation + '%')
AND
  (@isVisible IS NULL OR [IsVisible] = @isVisible)
AND
  (@isDeleted IS NULL OR [IsDeleted] = @isDeleted)
AND
  (@createDate IS NULL OR [CreateDate] = @createDate)
AND
  (@lastModifiedDate IS NULL OR [LastModifiedDate] = @lastModifiedDate)
GO
